import { Component, PropsWithChildren } from 'react';
import Taro from '@tarojs/taro';
import './app.scss';

class App extends Component<PropsWithChildren> {
  componentDidMount() {}

  componentDidShow() {}

  componentDidHide() {}

  onLaunch() {
    if (Taro.getEnv() === Taro.ENV_TYPE.WEAPP) {
      try {
        Taro.cloud.init({
          env: process.env.TARO_CLOUD_ENV_ID,
          traceUser: true, // 可以在云开发控制台追踪用户信息
        });
        console.log('云开发初始化成功');
      } catch (e) {
        console.error('云开发初始化失败', e);
      }
    }
  }

  render() {
    // this.props.children 是将要会渲染的页面
    return this.props.children;
  }
}

export default App;
